/*
 * ******************************************************
 *   Copyright ©, 2017-2020, 安徽财金信息科技有限公司
 * ******************************************************
 */
package com.wy.poties.common.model;



/**
 * <p>Description:</p>
 *
 *
 * @author
 * @version 1.0
 * @date 2020/6/4 0004 16:22
 */
public class MainContext {

    /**
     * 请求信息上下文
     */
    private static final ThreadLocal<ReqInfo> REQ_CONTEXT_HOLDER = new ThreadLocal<>();

    /**
     * 用户信息上下文
     */
    private static final ThreadLocal<AuthInfo> AUTH_CONTEXT_HOLDER = new ThreadLocal<>();

    /**
     * private constructor
     */
    private MainContext() {
    }

    public static AuthInfo getAuth() {
        return AUTH_CONTEXT_HOLDER.get();
    }

    public static void setAuth(AuthInfo user) {
        AUTH_CONTEXT_HOLDER.set(user);
    }

    public static void clearAuth() {
        AUTH_CONTEXT_HOLDER.remove();
    }

    public static ReqInfo getReqContext() {
        return REQ_CONTEXT_HOLDER.get();
    }

    public static void setReqContext(ReqInfo reqContext) {
        REQ_CONTEXT_HOLDER.set(reqContext);
    }

    public static void clearReqContext() {
        REQ_CONTEXT_HOLDER.remove();
    }

}